<br />
<div class="menus">
	<ul id="navigation" class="filetree treeview">
		<li><span class="home"><a href="./" title="P&aacute;gina Inicial">Home</a></span></li>
		<?php 
			if ($session_perfil == 'Administrador') {
				$administracao = "<li class='closed'><span class='folder'><a href='?aplicativo=admin' title='Administra&ccedil;&atilde;o'>Administra&ccedil;&atilde;o</a></span>\n";
				$administracao .= "<ul>\n";
				$administracao .= "<li><span class='file'><a href='?aplicativo=admin&amp;subaplicativo=diarios' >Di&aacute;rios</a></span></li>\n";
				$administracao .= "<li><span class='file'><a href='?aplicativo=admin&amp;subaplicativo=pastas' >Pastas</a></span></li>\n";
				$administracao .= "<li><span class='file'><a href='?aplicativo=admin&amp;subaplicativo=areas'>&Aacute;reas</a></span></li>\n";
				$administracao .= "<li><span class='file'><a href='?aplicativo=admin&amp;subaplicativo=captura'>Captura</a></span></li>\n";
				$administracao .= "<li><span class='file'><a href='?aplicativo=admin&amp;subaplicativo=menus'>Menus</a></span></li>\n";
				$administracao .= "<li><span class='file'><a href='?aplicativo=admin&amp;subaplicativo=operadoras'>Operadoras</a></span></li>\n";
				$administracao .= "<li><span class='file'><a href='?aplicativo=admin&amp;subaplicativo=perfis'>Perfis</a></span></li>\n";
				$administracao .= "<li><span class='file'><a href='?aplicativo=admin&amp;subaplicativo=produtos'>Produtos</a></span></li>\n";
				$administracao .= "<li><span class='file'><a href='?aplicativo=admin&amp;subaplicativo=ramos'>Ramos</a></span></li>\n";
				$administracao .= "<li><span class='file'><a href='?aplicativo=admin&amp;subaplicativo=regionais'>Regionais</a></span></li>\n";
				$administracao .= "<li><span class='file'><a href='?aplicativo=admin&amp;subaplicativo=secoes'>Se&ccedil;&otilde;es</a></span></li>\n";
				$administracao .= "<li><span class='file'><a href='?aplicativo=admin&amp;subaplicativo=usuarios'>Usu&aacute;rios</a></span></li>\n";							
				$administracao .= "</ul>\n";
				$administracao .= "</li>\n";
				echo $administracao;
			}	
	$con_sistemas = New Conexao($bd); 
	$con_secoes = New Conexao($bd);
	$con_menus = New Conexao($bd);
		$sql_sistemas = "SELECT sistemas.nome, sistemas.descricao FROM sistemas WHERE id IN (" . str_replace(";",",",$session_sistemas) . ") "; 
		$con_sistemas->Executar($sql_sistemas);
		if($con_sistemas->ContarLinhas() > 0) {
			while ($rs_sistemas = $con_sistemas->MostrarResultados()){
				echo "<li class='closed'><span class='folder'><a href='?aplicativo=$rs_sistemas[1]' title='Teste'>$rs_sistemas[0]</a></span>\n";
				echo "<ul>\n";
				$sql_secoes = "SELECT id, descricao FROM secoes WHERE sistema = '$rs_sistemas[1]' ";
				$con_secoes->Executar($sql_secoes);
				if($con_secoes->ContarLinhas() > 0) {
					while ($rs_secoes = $con_secoes->MostrarResultados()) {
						echo "<li class='closed'><span class='folder'><a href='#' title='Teste'>$rs_secoes[1]</a></span>\n";
						echo "<ul>\n";
						$sql_menus = "SELECT id, descricao, link FROM menus WHERE secao = $rs_secoes[0]";
						$con_menus->Executar($sql_menus);
						if($con_menus->ContarLinhas() > 0) {
							while ($rs_menus = $con_menus->MostrarResultados()) {
								echo "<li><span class='file'><a href='?aplicativo=$rs_sistemas[1]&amp;subaplicativo=$rs_menus[2]' title='Teste'>$rs_menus[1]</a></span></li>\n";
							}
						}
					echo "</ul>";
					echo "</li>";
					}
				}
				echo "</ul>\n";
				echo "</li>\n";
			}
		}
	$con_sistemas->Liberar();
	$con_secoes->Liberar();
	$con_menus->Liberar();
	?>
	</ul>
</div>